package com.jvm123.api.img.controller.rest;

import com.jvm123.api.util.Page;
import com.jvm123.api.img.entity.Image;
import com.jvm123.api.img.service.ImageService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author yawn http://jvm123.com
 * 2019/12/30 15:54
 */
@RestController
@RequestMapping("api/img")
public class RestImgController {

    @Resource
    private ImageService imageService;

    @GetMapping("page")
    public Page<Image> page(int page, int size) {
        return imageService.page(page, size);
    }

    @GetMapping("sync")
    public boolean sync() {
        return imageService.sync();
    }

    @PostMapping("update")
    public boolean update(String id, String title, String content) {
        return imageService.update(id, title, content);
    }
}
